﻿namespace Sidvall.WorkItemManager.Data.Entity.Entities
{
    public partial class WorkItemType : global::Sidvall.Data.DataRowBase, global::Sidvall.WorkItemManager.Data.IWorkItemType
    {
        #region Public Members

        #region Codename

        private string _Codename;
        public string Codename
        { 
            get
            {
                return _Codename;
            }
            set
            {
                _Codename = value;
            }
        }

        #endregion
        #region ContextEditor

        private string _ContextEditor;
        public string ContextEditor
        { 
            get
            {
                return _ContextEditor;
            }
            set
            {
                _ContextEditor = value;
            }
        }

        #endregion
        #region Description

        private string _Description;
        public string Description
        { 
            get
            {
                return _Description;
            }
            set
            {
                _Description = value;
            }
        }

        #endregion
        #region ExecutionContextEditor

        private string _ExecutionContextEditor;
        public string ExecutionContextEditor
        { 
            get
            {
                return _ExecutionContextEditor;
            }
            set
            {
                _ExecutionContextEditor = value;
            }
        }

        #endregion
        #region Name

        private string _Name;
        public string Name
        { 
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }

        #endregion
        #region WorkItemTypeId

        private long _WorkItemTypeId;
        public long WorkItemTypeId
        { 
            get
            {
                return _WorkItemTypeId;
            }
            set
            {
                _WorkItemTypeId = value;
            }
        }

        #endregion
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual System.Collections.Generic.ICollection<Sidvall.WorkItemManager.Data.Entity.Entities.WorkItem> WorkItem { get; set; }
        
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.WorkItemManager.Data.Entity.SystemContext.Current.EntityFacade.WorkItemTypeManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.WorkItemManager.Data.Entity.SystemContext.Current.EntityFacade.WorkItemTypeManager.DataRowStateIsDirty(this);
            }
        }

        #endregion

        #region IWorkItemType Members

        string global::Sidvall.WorkItemManager.Data.IWorkItemType.Codename
        {
            get
            {
                return this._Codename;
            }
            set
            {
                this.Codename = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItemType.ContextEditor
        {
            get
            {
                return this._ContextEditor;
            }
            set
            {
                this.ContextEditor = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItemType.Description
        {
            get
            {
                return this._Description;
            }
            set
            {
                this.Description = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItemType.ExecutionContextEditor
        {
            get
            {
                return this._ExecutionContextEditor;
            }
            set
            {
                this.ExecutionContextEditor = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItemType.Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this.Name = value;
            }
        }
        System.Nullable<long> global::Sidvall.WorkItemManager.Data.IWorkItemType.WorkItemTypeId
        {
            get
            {
                return this._WorkItemTypeId;
            }
            set
            {
                if (value != null)
                    this.WorkItemTypeId = value.Value;
            }
        }
        System.Nullable<System.Int32> global::Sidvall.WorkItemManager.Data.IWorkItemType.ServerConnectionId
        {
            get
            {
                return null;
            }
            set
            {
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        System.Collections.Generic.IEnumerable<IWorkItem> global::Sidvall.WorkItemManager.Data.IWorkItemType.WorkItems
        {
            get
            {
                return this.WorkItem;
            }
        }
        void global::Sidvall.WorkItemManager.Data.IWorkItemType.SetWorkItems(Sidvall.Data.IDataRowProvider<global::Sidvall.WorkItemManager.Data.IWorkItem> items)
        {
            this.WorkItem = items as WorkItemCollection;
        }

        #endregion

        #endregion
        #region Constructors

        public WorkItemType() : this(false, null, null)
        {
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public WorkItemType(bool initializeChildren, Sidvall.Data.IDataRowContextProvider context, Sidvall.Data.DataRowState? dataRowState)
        {
            if ((context != null) || (dataRowState != null))
                SetDataRowContext(context, dataRowState);
            if (initializeChildren)
            {
                this.WorkItem = new System.Collections.Generic.List<WorkItem>();
            }
        }

        #endregion
    }
}